<%@ Page language="c#" ValidateRequest="false" %>
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
	<HEAD>
		<title>Insert Code</title>
		<base target="_self">
		<script language="C#" runat="server">

private void Page_Load(object sender, System.EventArgs e) {
	if (newtelligence.DasBlog.Web.SiteSecurity.IsInRole("admin") == false) 
    {
		Response.Redirect("~/FormatPage.aspx?path=SiteConfig/accessdenied.format.html");
    }
}
		</script>
		<META HTTP-EQUIV="Expires" CONTENT="0">
	</HEAD>
	<body style="PADDING-RIGHT:10px; PADDING-LEFT:10px; PADDING-BOTTOM:10px; PADDING-TOP:10px">
		<form id="Form1" runat="server">
			<asp:dropdownlist id="languageDropDown" runat="server">
				<asp:listitem value="C#">C#</asp:listitem>
				<asp:listitem value="VB.NET">VB.NET</asp:listitem>
				<asp:listitem value="J#">J#</asp:listitem>
				<asp:listitem value="T-SQL">T-SQL</asp:listitem>
			</asp:dropdownlist>
			<br>
			<asp:textbox id="sourceTextBox" textmode="multiline" columns="60" rows="10" runat="server" Width="100%" />
			<br>
			<asp:button id="parseButton" onclick="parseButton_Click" text="Parse Code" runat="server" />
			<INPUT id="Button1" type="button" onclick="returnCode()" value="Insert Code" name="Button1"
				runat="server">&nbsp;
			<hr>
			<pre style="FONT-SIZE: 11px; FONT-FAMILY: Courier New"><asp:literal id="resultLabel" runat="server"/>
<asp:TextBox id=codeText runat="server" Width="0px" Height="0px" TextMode="MultiLine"></asp:TextBox>
		</form>
		<script language="javascript">
function returnCode() {
	var text;
	

	text = document.getElementById('codeText').value;
	window.returnValue = text;


	window.close();	
}		
		</script>
		<script language="c#" runat="server">
void parseButton_Click(object sender, EventArgs e)
{
	AylarSolutions.Highlight.Highlighter h = 
				new AylarSolutions.Highlight.Highlighter();
	h.ConfigurationFile = Server.MapPath("CodeHighlightDefinitions.xml");
	h.OutputType = AylarSolutions.Highlight.OutputType.Html;
	string result = h.Highlight(sourceTextBox.Text, languageDropDown.SelectedValue);
	result = result.Replace("\t", "&nbsp;&nbsp;&nbsp;&nbsp;");
	result = result.Replace(Environment.NewLine, "<br>");
	resultLabel.Text = result;
	codeText.Text = "<p>" + result + "</p>";
}
		</script>
	</body>
</HTML>
